package com.nebula.salary.portal.controller;


import com.nebula.salary.common.result.ServerResponse;
import com.nebula.salary.model.pojo.Navigation;
import com.nebula.salary.portal.service.INavigationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author codex
 * @since 2022-01-24
 */
@RestController
@RequestMapping("/portal/navigation")
@Api(tags = "前端路由")
public class NavigationController {
    
    @Autowired
    private INavigationService navigationService;
    
    @ApiOperation("获取登录用户有权限的菜单")
    @GetMapping("/")
    public ServerResponse<List<Navigation>> getNavigation(@ApiParam("request") HttpServletRequest request) {
    
        List<Navigation> navigations = navigationService.getNavigation(request);
        
        return ServerResponse.createBySuccess(navigations);
    }
    
}

